package kr.pe.johnkim.waiting.mobile.service;

import kr.pe.johnkim.waiting.mobile.dao.WaitingCertificationDao;
import kr.pe.johnkim.waiting.mobile.domain.WaitingSMS;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Waiting 인증 관련 Service 구현 클래스 이다.
 *
 * @author : John_Kim <cale9797@gmail.com>
 * @date : 13. 5. 3.
 */
@Service
public class WaitingCertificationServiceImpl implements WaitingCertificationService {

    // SLF4J Logging
    private Logger logger = LoggerFactory.getLogger(WaitingEventServiceImpl.class);

    @Autowired
    private WaitingCertificationDao waitingCertificationDao;

    /**
     * 인증 번호를 등록 한다.
     *
     * @param waitingSMS
     */
    @Override
    public void registerCertification(WaitingSMS waitingSMS) {
        logger.info("registerCertification");
        this.waitingCertificationDao.registerCertification(waitingSMS);
    }

    /**
     * 해당 멤버의 인증 정보가 있는지 확인 한다.
     *
     * @param waitingSMS
     * @return
     */
    @Override
    public WaitingSMS selectExistCertificationInformation(WaitingSMS waitingSMS) {
        logger.info("selectExistCertificationInformation");
        return this.waitingCertificationDao.selectExistCertificationInformation(waitingSMS);
    }

    /**
     * 해당 멤버의 인증 정보를 가져 온다.
     *
     * @param waitingSMS
     * @return
     */
    @Override
    public WaitingSMS selectCertificationInformation(WaitingSMS waitingSMS) {
        logger.info("selectCertificationInformation");
        return this.waitingCertificationDao.selectCertificationInformation(waitingSMS);
    }

    /**
     * 해당 인증 정보를 비활성화 한다.
     *
     * @param waitingSMS
     */
    @Override
    public void updateDeactivateCertification(WaitingSMS waitingSMS) {
        logger.info("updateDeactivateCertification");
        this.waitingCertificationDao.updateDeactivateCertification(waitingSMS);
    }
}
